home *** CD-ROM | disk | FTP | other *** search
- // ===========================================================================
- // WaitNextEventPatch.c ©1999 Eric Traut
- // ===========================================================================
-
- // This file implements a WaitNextEvent patch that can be applied within
- // the Finder that keeps it from specifying a sleep time that is too long.
-
- #include "WaitNextEventPatch.h"
-
- #include <Events.h>
- #include <Patches.h>
- #include <Traps.h>
- #include <Gestalt.h>
-
- static void DataForPatch(void);
- static pascal Boolean WaitNextEventPatch(EventMask eventMask, EventRecord * theEvent, UInt32 sleep, RgnHandle mouseRgn);
-
-
- // ---------------------------------------------------------------------------
- // • main (InstallPatch)
- // ---------------------------------------------------------------------------
-
- pascal void
- main(void)
- {
- WNEPatchInfo * patchInfo;
- patchInfo = (WNEPatchInfo *)&DataForPatch;
-
- patchInfo->fPatchEntry = &WaitNextEventPatch;
- patchInfo->fPatchCallThrough = (WaitNextEventProc)GetToolTrapAddress(_WaitNextEvent);
- patchInfo->fPatchActive = true;
-
- SetToolTrapAddress((UniversalProcPtr)&WaitNextEventPatch, _WaitNextEvent);
- }
-
-
- // ---------------------------------------------------------------------------
- // • WaitNextEventPatch
- // ---------------------------------------------------------------------------
-
- pascal Boolean
- WaitNextEventPatch(
- EventMask eventMask,
- EventRecord * theEvent,
- UInt32 sleep,
- RgnHandle mouseRgn)
- {
- WNEPatchInfo * patchInfo;
- patchInfo = (WNEPatchInfo *)&DataForPatch;
-
- (void) DeleteGestaltValue(gestaltWNEPatch);
- (void) NewGestaltValue(gestaltWNEPatch, (long)patchInfo);
-
- if (patchInfo->fPatchActive)
- sleep = 1;
-
- return (*patchInfo->fPatchCallThrough)(eventMask, theEvent, sleep, mouseRgn);
- }
-
-
- // ---------------------------------------------------------------------------
- // • DataForPatch
- // ---------------------------------------------------------------------------
-
- void
- DataForPatch(void)
- {
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- Debugger();
- }
-
-
-
-
-